home *** CD-ROM | disk | FTP | other *** search
/ Aminet 50 / Aminet 50 (2002)(GTI - Schatztruhe)[!][Aug 2002].iso / Aminet / dev / misc / Progr_Langs_v7.lha / Progr_Langs / Source / exe_timer.asc next >
Text File  |  1999-01-31  |  1KB  |  59 lines

  1. WBStartup
  2.  
  3. Goto versionskip
  4. version:
  5. Even
  6. Dc.b "$VER: exe_timer 2.0 (31.01.99)",0
  7. Even
  8. versionskip:
  9.  
  10. If NumPars >= 1
  11.   If Par$(1)="?"
  12.     PutStr_ "Usage: exe_timer PROGRAM"+Chr$(10)
  13.     PutStr_ Chr$(10)
  14.     PutStr_ "exe_timer measures the execution time of PROGRAM in ``ticks''"+Chr$(10)
  15.     PutStr_ "and its memory loss."+Chr$(10)
  16.     PutStr_ Chr$(10)
  17.     PutStr_ "Hint: Subtract about 2 ticks from the result which are required"+Chr$(10)
  18.     PutStr_ "      for loading PROGRAM."+Chr$(10)
  19.   Else
  20.     n$=""
  21.     For t.l=1 To NumPars
  22.       n$=n$+Par$(t.l)+" "
  23.     Next t
  24.     n$=StripTrail$(n$,32)
  25.     PutStr_ "exe_timer: Running ``"+n$+"''..."+Chr$(10)
  26.     PutStr_ Chr$(10)
  27.     f1=FastFree
  28.     c1=ChipFree
  29.     Delay_ 10
  30.     a.l=Ticks
  31.     r.l=SystemTagList_ (n$,?tl)
  32.     r2.l=IoErr_
  33.     b.l=Ticks
  34.     Delay_ 10
  35.     c.l=b.l-a.l
  36.     f2=FastFree
  37.     c2=ChipFree
  38.     fm=f2-f1
  39.     cm=c2-c1
  40.     PutStr_ Chr$(10)
  41.     If c.l<0
  42.       PutStr_ "exe_timer: Timer error - try again"+Chr$(10)
  43.     Else
  44.       PutStr_ "-> elapsed time:       "+UStr$(c.l)+" ticks"+Chr$(10)
  45.       PutStr_ "-> result code:        "+UStr$(r.l)+Chr$(10)
  46.       PutStr_ "-> IoErr() code:       "+UStr$(r2.l)+Chr$(10)
  47.       PutStr_ "-> memory loss (Chip): "+UStr$(cm)+" bytes"+Chr$(10)
  48.       PutStr_ "-> memory loss (Fast): "+UStr$(fm)+" bytes"+Chr$(10)
  49.     End If
  50.   End If
  51. Else
  52.   PutStr_ "exe_timer: Required argument missing"+Chr$(10)
  53. End If
  54. End
  55.  
  56. tl:
  57. Dc.l 0,0
  58.  
  59.